package com.ruoyi.business.service.impl;

import com.ruoyi.business.domain.TenantComponentParametersVersion;
import com.ruoyi.business.mapper.TenantComponentParametersVersionMapper;
import com.ruoyi.business.service.ITenantComponentParametersVersionService;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 租户复合组件参数版本表Service业务层处理
 *
 * @author ruoyi
 * @date 2025-11-18
 */
@Service
public class TenantComponentParametersVersionServiceImpl implements ITenantComponentParametersVersionService
{
    @Autowired
    private TenantComponentParametersVersionMapper tenantComponentParametersVersionMapper;

    /**
     * 查询租户复合组件参数版本表
     *
     * @param id 租户复合组件参数版本表主键
     * @return 租户复合组件参数版本表
     */
    @Override
    public TenantComponentParametersVersion selectTenantComponentParametersVersionById(Long id)
    {
        return tenantComponentParametersVersionMapper.selectTenantComponentParametersVersionById(id);
    }

    /**
     * 查询租户复合组件参数版本表列表
     *
     * @param tenantComponentParametersVersion 租户复合组件参数版本表
     * @return 租户复合组件参数版本表
     */
    @Override
    public List<TenantComponentParametersVersion> selectTenantComponentParametersVersionList(TenantComponentParametersVersion tenantComponentParametersVersion)
    {
        return tenantComponentParametersVersionMapper.selectTenantComponentParametersVersionList(tenantComponentParametersVersion);
    }

    /**
     * 新增租户复合组件参数版本表
     *
     * @param tenantComponentParametersVersion 租户复合组件参数版本表
     * @return 结果
     */
    @Override
    public int insertTenantComponentParametersVersion(TenantComponentParametersVersion tenantComponentParametersVersion)
    {
        tenantComponentParametersVersion.setCreateTime(DateUtils.getNowDate());
        return tenantComponentParametersVersionMapper.insertTenantComponentParametersVersion(tenantComponentParametersVersion);
    }

    /**
     * 修改租户复合组件参数版本表
     *
     * @param tenantComponentParametersVersion 租户复合组件参数版本表
     * @return 结果
     */
    @Override
    public int updateTenantComponentParametersVersion(TenantComponentParametersVersion tenantComponentParametersVersion)
    {
        tenantComponentParametersVersion.setUpdateTime(DateUtils.getNowDate());
        return tenantComponentParametersVersionMapper.updateTenantComponentParametersVersion(tenantComponentParametersVersion);
    }

    /**
     * 批量删除租户复合组件参数版本表
     *
     * @param ids 需要删除的租户复合组件参数版本表主键
     * @return 结果
     */
    @Override
    public int deleteTenantComponentParametersVersionByIds(Long[] ids)
    {
        return tenantComponentParametersVersionMapper.deleteTenantComponentParametersVersionByIds(ids);
    }

    /**
     * 删除租户复合组件参数版本表信息
     *
     * @param id 租户复合组件参数版本表主键
     * @return 结果
     */
    @Override
    public int deleteTenantComponentParametersVersionById(Long id)
    {
        return tenantComponentParametersVersionMapper.deleteTenantComponentParametersVersionById(id);
    }

    @Override
    public int deleteParametersVersionByComponentKey(String componentKey, String enterpriseCode, Integer version) {
        return tenantComponentParametersVersionMapper.deleteParametersVersionByComponentKey(componentKey,enterpriseCode,version);
    }
}
